/**
 * Created by wust on 2019-11-09 11:16:52
 * Copyright © 2019 wust. All rights reserved.
 */
package com.wust.smartcity.admin.server.core.api.feign.server;

import com.wust.smartcity.admin.server.core.service.SysNotificationService;
import com.wust.smartcity.common.annotations.FeignApi;
import com.wust.smartcity.common.dto.WebResponseDto;
import com.wust.smartcity.common.entity.sys.notification.SysNotification;
import com.wust.smartcity.common.util.MyIdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @author: wust
 * @date: Created in 2019-11-09 11:16:52
 * @description:
 *
 */
@FeignApi
@RequestMapping("/api/feign/v1/NotificationFeignApi")
@RestController
public class NotificationFeignApi {
    @Autowired
    private SysNotificationService sysNotificationServiceImpl;


    @RequestMapping(value = "/create",method= RequestMethod.POST)
    public WebResponseDto create(@RequestBody SysNotification entity) {
        WebResponseDto responseDto = new WebResponseDto();
        entity.setId(MyIdUtil.getId());
        sysNotificationServiceImpl.insert(entity);
        responseDto.setObj(entity.getId());
        return responseDto;
    }


    @RequestMapping(value = "/deleteByPrimaryKey",method= RequestMethod.POST)
    public WebResponseDto deleteByPrimaryKey(@RequestParam Long id) {
        WebResponseDto responseDto = new WebResponseDto();
        sysNotificationServiceImpl.deleteByPrimaryKey(id);
        return responseDto;
    }



    @RequestMapping(value = "/select",method= RequestMethod.POST)
    public WebResponseDto select(@RequestBody SysNotification search) {
        WebResponseDto responseDto = new WebResponseDto();
        List<SysNotification> notifications = sysNotificationServiceImpl.select(search);
        responseDto.setLstDto(notifications);
        return responseDto;
    }
}
